﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class TimeController : MonoBehaviour {
    private int atime;
    private float btime;
    public GameObject TimePanel;
    public UILabel TimeMiaoDown;
    public UILabel TimeFenDown;
    // Use this for initialization
    void Start () {
        TimeMiaoDown.text = btime.ToString();
        TimeFenDown.text = atime.ToString();
        atime = 8;
        btime = 59;
	}

    // Update is called once per frame
	void Update () {
        btime -= Time.deltaTime;
        TimeMiaoDown.text = Mathf.Round(btime).ToString();
        TimeFenDown.text = atime.ToString();
        if (btime<0)
        {
            atime--;
            btime = 59;
            if (atime<0)
            {
                atime = 8;
            }
        }
    }
    
    public void OnHover(bool isOver)
    {
        if (isOver)
        {
            TimePanel.SetActive(true);
        }
        else
        {
            TimePanel.SetActive(false);
        }
    }
}
